<% home = current_page?(root_path) || current_page?(advanced_search_path) %>
<div class="<%= home ? "home__search-wrap" : "header__search-wrap" %>" role="search">
  <%= form_tag search_path, method: :get, data: { controller: "autocomplete", autocomplete_selected_class: "selected", } do %>
    <%= rubygem_search_field(
      class: (home ? "home__search" : "header__search"),
      data: (home ? nil : { nav_target: "search" }),
    ) %>

    <ul class="suggest-list" role="listbox" data-autocomplete-target="suggestions"></ul>

    <template id="suggestion" data-autocomplete-target="template">
      <li class="menu-item" role="option" tabindex="-1" data-autocomplete-target="item" data-action="click->autocomplete#choose mouseover->autocomplete#highlight"></li>
    </template>

    <%= label_tag :query, id: "querylabel" do %>
      <span class="t-hidden"><%= t('layouts.application.header.search_gem_html') %></span>
    <% end %>

    <%= submit_tag '⌕', id: "search_submit", name: nil, class: home ? "home__search__icon" : "header__search__icon", aria: { labelledby: "querylabel" } %>

    <% if home %>
      <center>
        <%= link_to t("advanced_search"), advanced_search_path, class: "home__advanced__search t-link--has-arrow"%>
      </center>
    <% end %>
  <% end %>
</div>
